<template>
	<view class="page">
		<view class="flex0">
			<u-navbar :fixed='false' bgColor="transparent" @leftClick="navBack" :title="info.title">
				<view slot="center" class="navTitle">
					{{info.displayName}}
				</view>
			</u-navbar>
		</view>
		<view class="flex1">
			<scroll-view scroll-y="true" class="scrollView pt30">
				<view class="projectInfo pd30">
					<view class="tp">
						<view class="infoHead" v-if="info.displayName">
							<view class="tit">
								{{info.displayName}}
							</view>
						</view>
						<view class="desc" v-html="info.content"></view>
						<view class="testIndicators">
							<view class="t">
								测评指标
							</view>
							<view class="ul">
								<view class="li">
									<view class="ll">
										测试题数
									</view>
									<view class="lr">
										<text class="act pr5">{{info.topicCount}}</text>
										<text>题</text>
									</view>
								</view>
								<view class="li">
									<view class="ll">
										预计用时
									</view>
									<view class="lr">
										<text class="act pr5">{{info.limitTime}}</text>
										<text>分钟</text>
									</view>
								</view>
								<!-- <view class="li">
									<view class="ll">
										重测时间
									</view>
									<view class="lr">
										<text class="act">{{info.timeGap}}</text>
										<text></text>
									</view>
								</view> -->
							</view>
						</view>
					</view>
					<view class="tb">
						<view class="btn" @tap="goTest">
							开始答题
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				taskId:'',
				itemid: '',
				info: {}
			}
		},
		methods: {
			getInfo() {

				this.$api.questionInfo({
					id: this.itemid
				}, res => {
					if (res.code == 200) {
						console.log(res.data)
						this.info = res.data
					}
				})
			},
			goTest(id) {
				if(this.evaluationId){
					
					uni.navigateTo({
						url: `/subpage/testForm/testForm?id=${this.itemid}&evaluationId=${this.evaluationId}`
					});
				}else{
					
					uni.navigateTo({
						url: `/subpage/testForm/testForm?id=${this.itemid}&taskId=${this.taskId}`
					});
				}
			}
		},
		onLoad(e) {
			this.itemid=e.id
			if(e.taskId){
				
				this.taskId=e.taskId
			}
			if(e.evaluationId){
				
				this.evaluationId=e.evaluationId
			}
			this.getInfo();
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		background: #fff;
	}

	.projectInfo {
		display: flex;
		flex-direction: column;
		min-height: 100%;
		justify-content: space-between;
		padding-bottom: 120rpx;
		box-sizing: border-box;

		.tp {
			flex: 0 0 auto;
			width: 100%;
		}

		.tb {
			flex: 0 0 auto;
			width: 100%;
			margin-top: 30rpx;

			.btn {
				line-height: 90rpx;
				font-size: 28rpx;
				background: #fe9c29;
				color: #fff;
				text-align: center;
				border-radius: 90rpx;
			}
		}

		.infoHead {
			.tit {
				margin-bottom: 40rpx;
				font-size: 48rpx;
				font-weight: bold;
				color: #65554d;
			}
		}

		.desc {
			font-size: 28rpx;
			line-height: 1.5;
			color: #897f7a;
			margin-bottom: 50rpx;
		}

		.testIndicators {
			padding: 30rpx 30rpx 30rpx 0;
			box-sizing: border-box;
			background: linear-gradient(90deg, transparent, #f9eee7);
			border-radius: 20rpx;

			.t {
				font-size: 32rpx;
				color: #65554d;
				line-height: 1;
				margin-bottom: 40rpx;
			}

			.ul {
				padding-left: 30rpx;
				border-left: 2rpx solid #fe9c29;

				.li {
					line-height: 1;
					margin-bottom: 16rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;
					font-size: 28rpx;
					color: #897f7a;

					&:last-child {
						margin-bottom: 0;
					}

					.lr {
						flex: 0 0 auto;

						.act {
							color: #fe9c29;
						}

						.pr5 {
							padding-right: 10rpx;
						}
					}
				}
			}
		}
	}
</style>